<template>
  <div class="viewContain">
    <el-form :model="listQuery" size="small" label-width="100px">
      <el-row>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 8 }" :xl="{ span: 8 }">
          <el-form-item label="服务ID:">
            <el-input
              v-model="listQuery.name"
              placeholder="请输入内容"
              clearable
              @keyup.enter.native="handleSearch"
            />
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 8 }" :xl="{ span: 8 }">
          <el-form-item label="服务编码:">
            <el-input
              v-model="listQuery.no"
              placeholder="请输入内容"
              clearable
              @keyup.enter.native="handleSearch"
            />
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 8 }" :xl="{ span: 8 }">
          <el-form-item label="服务地址:">
            <el-input
              v-model="listQuery.no"
              placeholder="请输入内容"
              clearable
              @keyup.enter.native="handleSearch"
            />
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 8 }" :xl="{ span: 8 }">
          <el-form-item label="备注:">
            <el-input
              v-model="listQuery.no"
              placeholder="请输入内容"
              clearable
              @keyup.enter.native="handleSearch"
            />
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 8 }" :xl="{ span: 8 }">
          <el-form-item>
            <el-button size="mini" type="primary" @click="handleSearch">查询</el-button>
            <el-button size="mini" type="primary" @click="handleReload">重置</el-button>
            <el-button size="mini" type="primary" @click="handleAdd">新增</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <!-- 新增路由地址 -->
    <el-dialog
      :title="dialogTitle"
      :visible.sync="dialogFormVisible"
      :close-on-click-modal="false"
      width="400px"
    >
      <el-form :model="formData" size="small" label-width="120px" :rules="rules">
        <el-form-item label="服务ID:" prop="name">
          <el-input v-model="formData.name" clearable style="max-width:200px" />
        </el-form-item>
        <el-form-item label="服务编码:">
          <el-input v-model="formData.name" clearable style="max-width:200px" />
        </el-form-item>
        <el-form-item label="服务地址:">
          <el-input v-model="formData.name" clearable style="max-width:200px" />
        </el-form-item>
        <el-form-item label="备注:">
          <el-input v-model="formData.name" clearable style="max-width:200px" />
        </el-form-item>
        <el-form-item>
          <div style="text-align:right">
            <el-button size="mini" type="primary" @click="handleSave">保存</el-button>
            <el-button size="mini" type="primary" @click="handleClose">关闭</el-button>
          </div>
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-table
      ref="table"
      v-loading="loading"
      fit
      stripe
      :data="tableData"
      border
      size="mini"
    >
      <el-table-column type="selection" />
      <el-table-column align="center" label="序号" type="index" width="50">
        <template slot-scope="scope">
          <span>{{ (listQuery.pageNo - 1) * listQuery.pageSize + scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="name" align="center" label="服务ID" width="150" />
      <el-table-column prop="no" align="center" label="服务地址" width="150" />
      <el-table-column prop="q" align="center" label="服务编码" />
      <el-table-column prop="w" align="center" label="备注" />
      <el-table-column prop="w" align="center" label="创建时间" />
      <el-table-column prop="w" align="center" label="修改时间" />
      <el-table-column align="center" fixed="right" label="操作" width="100">
        <template slot-scope="scope">
          <el-button class="text-button" size="mini" @click="handleEdit(scope)">修改</el-button>
          <el-button class="text-button el-button--danger" size="mini" @click="handleDelete(scope)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      loading: false,
      listQuery: {
        pageNo: 1,
        pageSize: 10
      },
      dialogTitle: '新增路由地址',
      dialogFormVisible: false,
      formData: {},
      tableData: [
        {
          name: '开发测试',
          no: 'v1.0',
          q: 'enen',
          w: 'sfda',
          e: 'dg',
          r: 'ty'
        }
      ],
      rules: {
        name: [
          { required: true, message: '服务ID不能为空!', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    // 查询
    handleSearch() {},
    // 重置
    handleReload() {},
    // 新增
    handleAdd() {
      this.dialogFormVisible = true
    },
    // 修改
    handleEdit() {
      this.dialogFormVisible = true
    },
    // 删除
    handleDelete() {},
    // 保存
    handleSave() {},
    // 关闭
    handleClose() {
      this.dialogFormVisible = false
    }
  }
}
</script>
<style lang="scss" scoped>

</style>
